import {createStore} from "vuex";
import {GetTechStacks} from "../api/setting.js";
import {GetSchools} from "../api/school.js";

const store = createStore({
    state: {
        stacks: [],
        schools: [],
    },
    mutations: {
        SET_STACKS(state, stacks) {
            state.stacks = stacks;
        },
        SET_SCHOOLS(state, schools) {
            state.schools = schools;
        }
    },
    actions: {
        async updateStacks({ commit }) {
            const res = await GetTechStacks()
            commit('SET_STACKS', res.data.data);
        },
        async updateSchools({ commit }) {
            const res = await GetSchools()
            commit('SET_SCHOOLS', res.data.data);
        }
    },
});

export default store;